***JOP Kane, Mason, and Wronski****
use "JOP_KMW_Figure1_CCES.dta" file


*********************Figure 1: Average Perceived & Actual Group Allegiances in the American Public************
****Perceived from CCES; Actual from ANES*****

	*2012 *note:  Additional features were adjusted using Graph Editor
twoway scatter PCT_DEMVOTE_20122 PERCEIVED_PARTY, mlabel(GROUP2) ///
	name(g3,replace) || lfit PCT_DEMVOTE_20122 PERCEIVED_PARTY, ///
	ytitle("Percent Voting Democratic (2012)") legend(off)
	
	*2016 *note:  Additional features were adjusted using Graph Editor
twoway scatter PCT_DEMVOTE2016 PERCEIVED_PARTY, mlabel(GROUP2) ///
	name(g4,replace) || lfit PCT_DEMVOTE2016 PERCEIVED_PARTY, ///
	ytitle("Percent Voting Democratic (2016)") legend(off)

graph combine g3 g4, ycommon

	**correlations -- all groups
pwcorr PERCEIVED_PARTY PCT_DEMVOTE_20122 PCT_DEMVOTE2016, sig star(.05)
	**Democratic Groups Only
pwcorr PERCEIVED_PARTY PCT_DEMVOTE_20122 PCT_DEMVOTE2016 if group_party==0, sig star(.05)
	**Republican Groups Only
pwcorr PERCEIVED_PARTY PCT_DEMVOTE_20122 PCT_DEMVOTE2016 if group_party==1, sig star(.05)


*********************FIGURE D5.  Group Sentiments and Groups’ Partisan Electoral Behavior************
****Perceived from CCES; Actual from ANES*****

*2012
twoway scatter PCT_DEMVOTE_20122 BETA_X, mlabel(GROUP2) name(g5,replace) || lfit PCT_DEMVOTE_20122 BETA_X, ytitle("Percent Voting Democratic (2012)") xtitle("OLS Beta Coefficient on Group Closeness Variable") legend(off)
*2016
twoway scatter PCT_DEMVOTE2016 BETA_X, mlabel(GROUP2) name(g6,replace) || lfit PCT_DEMVOTE2016 BETA_X, ytitle("Percent Voting Democratic (2016)") xtitle("OLS Beta Coefficient on Group Closeness Variable") legend(off)

graph combine g5 g6, ycommon 
